<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<title>enterprise-detail-f</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
		<link rel="stylesheet" href="../css/bui.css">
		<script type="text/javascript" src="../script/api.js"></script>
		<script type="text/javascript" src="../script/zepto.js"></script>
		<script type="text/javascript" src="../script/doT.min.js"></script>
		<script type="text/javascript" src="../script/bui.js"></script>
		<style type="text/css">
			.solve-list{
				width:100%;
				height:100%;
			}
			.solve-list h3{
				font-weight: bold;
				font-size: .36rem;
			}
			.bui-list label{
				text-align-last: justify;
		    -moz-text-align-last: justify ;  //兼容firefox
		    text-align: justify;
		    text-justify: distribute-all-lines;  //兼容ie
		    display: block; //ie下需设为block
				width: 1.8rem;
			}
			.line{
				width: 100%;
				height: 2px;
				background: #eee;
			}
			.bui-list>[class*=bui-btn]{
				border-bottom: none;
			}
			input.bui-tag, input.bui-check{
				width: 1.8rem;
				border-radius: .3rem;
			}
			.img-list{
				padding-bottom: .2rem;
			}
			.img-list img{
				width: 100%;
				height: 100%;
			}
			.bui-nav.bui-fluid>[class*=bui-btn].bui-box-vertical{
				padding: .2rem;
				height: 2.6rem;
			}
			.span4{
			  color: #000;
			}
			.bui-box a.into-map{
				padding: .1rem .2rem;
				border-radius: .2rem;
				text-align: center;
				background: #2F9CF0;
				color: #fff;
			}
			.bui-box .span1 a.mobile{
				color: red;
				text-decoration: underline;
			}
		</style>
	</head>
<body style="background-color:#fff;">
<div class="bui-page page-form" id="content"></div>
<script id="tpl" type="text/x-dot-template">
	<main class="solve-list">
		<h3 class="section-title">详情</h3>
		<ul class="bui-list">
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">企业名称</label>：
				<div class="span1">
					{{=it.name}}
				</div>
			</li>
<!--			<li class="bui-btn bui-box clearactive">-->
<!--				<label class="bui-label">营业执照</label>：-->
<!--				<div class="span1">-->
<!--					{{=it.code}}-->
<!--				</div>-->
<!--			</li>-->
<!--			<li class="bui-btn bui-box clearactive">-->
<!--				<label class="bui-label">餐饮许可证</label>：-->
<!--				<div class="span1">-->
<!--					{{=it.licence}}-->
<!--				</div>-->
<!--			</li>-->
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">详细地址</label>：
				<div class="span1">
					{{=it.address}}
				</div>
				<a class="into-map" href="javascript:;" tapmode  onclick="intoMap('{{=it.longitude}}','{{=it.latitude}}','{{=it.id}}')">进入地图</a>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">负责人姓名</label>：
				<div class="span1">
						{{=it.owner}}
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">负责人手机</label>：
				<div class="span1">
						<a class="mobile" href="javascript:;" tapmode  onclick="callMobile('{{=it.ownerMobile}}')">{{=it.ownerMobile}}</a>
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">面积</label>：
				<div class="span1">
						{{=it.area}}
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">经度</label>：
				<div class="span4">
					{{=it.longitude}}
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">纬度</label>：
				<div class="span4">
					{{=it.latitude }}
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">灶头数</label>：
				<div class="span4">
					{{=it.stove}}
				</div>
			</li>
			<li class="bui-btn bui-box clearactive">
				<label class="bui-label">创建时间</label>：
				<div class="span4">
					{{=timestampToTime(it.createTime)}}
				</div>
			</li>
		</ul>
		<h3 class="section-title">企业照片</h3>
		<ul class="bui-nav shortcut-nav bui-fluid img-list">
			{{ var imgPath = it.imgPath; }}
			{{for(var p in imgPath){ }}
				<li class="bui-btn bui-box-vertical span4" tapmode onclick="openImageBrower('{{=imgPath}}','{{=p}}')"><img src="{{=static_url+imgPath[p]}}"/></li>
			{{ } }}
		</ul>
	</main>
</script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">

var CUISINE = [];
apiready = function(){

	//查询菜系字典
	getDicType();

}

function callMobile(mobile){
	api.call({
	    type: 'tel_prompt',
	    number: mobile
	});
}

function intoMap(longitude,latitude,id){
	api.openWin({
      name: 'control',
      url: './control.html',
			pageParam:{
				longitude: longitude,
				latitude: latitude,
				id: id
			}
  });
}

function setDicType(type){
	for(var i=0;i<CUISINE.length;i++){
		if(CUISINE[i].code == type){
			return CUISINE[i].name;
		}
	}
}

function getDicType() {
	var userData = $api.getStorage('mine');

	ajaxRequest('post', {
			apiCode: 'DIC_QUERY',
			userId: userData.userId,
			requestData: {
				pageNo: 1,
				pageSize: 999,
				parentCode: "CUISINE"
			}
	}, function (ret, err) {
			api.hideProgress();
			if (ret.code == 200) {
				CUISINE = ret.result.list;

				var data = api.pageParam;
				data.imgPath = [];
				if(data.photo1) data.imgPath.push(data.photo1);
				if(data.photo2) data.imgPath.push(data.photo2);
				if(data.photo3) data.imgPath.push(data.photo3);
				var tpl = $('#tpl').html();
				var content = doT.template(tpl);
				$('#content').html(content(data));

			} else {
				api.toast({
						msg: ret.message,
						location: 'middle'
				});
				return false;
			}
	});
}
function openImageBrower(arr, i) { //图片浏览器
		var str = arr.split(',');
		var data = [];
		for (var p in str) {
				data.push(static_url + str[p]);
		}
		//图片浏览器打开
		var obj = api.require('imageBrowser');
		obj.openImages({
				imageUrls: data,
				activeIndex: i
		});
}


</script>
</body>
</html>
